
/**
 * @Project : Clion_ProgrammingExercises
 * @File : 1
 * @Author : WangRuoyu 
 * @Date : 2023/5/16 17:34
 */

#include "iostream"
#include "algorithm"

using namespace std;

int main() {
    int n;
    cin >> n;
    int nums[n];
    for (int i = 0; i < n; ++i) {
        cin >> nums[i];
    }
    sort(nums, nums + n);
    cout << nums[n - 1] << " ";
    if (n % 2) {
        cout << nums[n >> 1] << " ";
    } else {
        int k = nums[n >> 1] + nums[(n - 1) >> 1];
        if (k % 2) {
            printf("%.1f ", k / 2.0);
        } else {
            cout << k / 2 << " ";
        }
    }
    cout << nums[0];
    return 0;
}